<?php include("../../data/mysql.class.php")?>
<?php include("../../data/Function.php")?>
<?php
	$Type=$_POST["Type"];
	$conn=new Mysql();
	switch($Type){
		case "delete":
		if($conn->query("delete from news_shop where id =".$_POST["id"])){
			echo 1;
			}else{
				echo 0;
				}
		break;
		case "add":
		
		$type=$_POST["type"];
		$title=$_POST["title"];
		$title_f=$_POST["title_f"];
		$content=$_POST["content"];	
		$JumpURL=$_POST["JumpURL"];
		$author=$_POST["author"];
		$pic1=$_POST["pic1"];
		//$picall=$_POST["picall"];
		$Linkcount=0;
		$adtitle=$_POST["adtitle"];	
		$adkeyword=$_POST["adkeyword"];	
		$adescription=$_POST["adescription"];
		$px=$_POST["px"];
		$is_hot=$_POST["is_hot"];
		$is_banner=$_POST["is_banner"];
		$JumpURL=$_POST["JumpURL"];
		$author=$_POST["author"];
		$Display_home=1;
		$sqltxt="insert into news_shop(type,title,title_f,content,JumpURL,author,Linkcount,pic,ArticleTitle,ArticleKeyword,ArticleDescribes,px,is_hot,Display_home,adate,is_banner) values($type,'$title','$title_f','$content','$JumpURL','$author',$Linkcount,'$pic1','$adkeyword','$adkeyword','$adescription',$px,$is_hot,$Display_home,'".now()."',$is_banner)";
		if($conn->query($sqltxt)){
					
				echo 1;}else{
					echo $sqltxt;
					}
		
		
		break;
		case "edit":
		
		$type=$_POST["type"];
		$title=$_POST["title"];
		$title_f=$_POST["title_f"];
		$content=$_POST["content"];	
		//$picall=$_POST["picall"];
		$adkeyword=$_POST["adtitle"];	
		$adkeyword=$_POST["adkeyword"];	
		$adescription=$_POST["adescription"];
		$adate=$_POST["adate"];
		$is_hot=$_POST["is_hot"];
		$JumpURL=$_POST["JumpURL"];
		$author=$_POST["author"];
		$Display_home=1;
		$pic1=$_POST["pic1"];	
		$is_banner=$_POST["is_banner"];
		$pid=$_POST["id"];
		$Linkcount=$_POST["Linkcount"];
		$sqltxt="update news_shop set type=$type,title='$title',title_f='$title_f',content='$content',JumpURL='$JumpURL',author='$author',pic='$pic1',ArticleTitle='$adkeyword',ArticleKeyword='$adkeyword',ArticleDescribes='$adescription',is_hot=$is_hot,is_banner=$is_banner,Display_home=$Display_home,Linkcount=$Linkcount,adate='$adate' where id=".$pid;
		if(@$conn->query($sqltxt)){
					
				echo 1;}else{
					echo $sqltxt;
					}
		
		break;
		case "checkstate":
			if($conn->query("update  news_shop set Display_home=".$_POST["isstate"]." where id =".$_POST["id"])){
			echo 1;
			}else{
				echo 0;
				}
		break;
		default:
		break;
		}
?>